<div ng-controller="SeedModules.Saas/modules/controllers/tenants" ng-init="load()">
    <form role="form" class="form-inline" style="margin-bottom: 20px">
        <select class="form-control">
            <option value="">全部</option>
            <option value="0">未初始化</option>
            <option value="2">运行中</option>
            <option value="3">已禁用</option>
            <option value="4">异常</option>
        </select>
        <input trigger-input ng-model="search.keyword" mark="'关键字...'" callback="keywordCallback()">
        <div class="pull-right">
            <button class="btn btn-primary" ng-click="create()">
                <i class="glyphicon glyphicon-plus"></i>
                添加
            </button>
            <button class="btn btn-default">
                <i class="glyphicon glyphicon-list"></i>
                批量操作
            </button>
        </div>
    </form>
    <table ng-table="tableParams" class="table table-striped table-hover">
        <colgroup>
            <col width="45px" />
        </colgroup>
        <tr ng-repeat="row in $data">
            <td header="'table-checkbox.html'">
                <input type="checkbox" ng-model="checked[row.name]" ng-change="onCheck()">
            </td>
            <td title="'名称'" sortable="true">{{row.name}}</td>
            <td title="'状态'">
                <span class="label" ng-bind="row.engineSettings.state|tenantState" ng-class="{
                    'label-default': row.engineSettings.state===0 || row.engineSettings.state===3,
                    'label-warning': row.engineSettings.state===1,
                    'label-success': row.engineSettings.state===2,
                    'label-error': row.engineSettings.state===4
                }"></span>
            </td>
            <td title="'操作'" style="width: 140px">
                <a href="">编辑</a>
                <a href="" ng-if="!row.isDefault&&row.engineSettings.state===2">禁用</a>
                <a href="" ng-if="!row.isDefault&&row.engineSettings.state===3">启用</a>
                <a href="" ng-if="!row.isDefault&&row.engineSettings.state!==0">重置</a>
                <a href="" class="text-danger" ng-if="!row.isDefault" ng-click="drop()">删除</a>
            </td>
        </tr>
    </table>
</div>

<script type="text/ng-template" id="table-checkbox.html">
    <input type="checkbox" ng-model="checkedAll" ng-click="checkAll()">
</script>